/*
 * This file is part of ksPlatform
 * 
 * Copyright (c) 2014-2015
 * 
 * This file is dual-licensed under the AGPLv3 (http://www.gnu.org/licenses/agpl-3.0.html) 
 * 
 * If you are unsure which license is appropriate for your use, please contact the sales department
 * at 97041437@qq.com.
 */

package cn.com.ksplatform.modules.system.auth.orgmanager.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;

import cn.com.ksplatform.base.BaseModel;
import cn.com.ksplatform.modules.system.auth.usermanager.model.PlatUser;

/**
 * @ClassName:PlatStation <br/>
 * @deprecated:TODO. <br/>
 * @Date: 2015年5月21日 下午4:35:00 <br/>
 * 
 * @author Mr.Luoxing
 * @version 1.0
 */

@Entity
@Table(name = "t_sys_station")
public class PlatStation extends BaseModel {
	
	@Id
	@GenericGenerator(name = "systemUUID", strategy = "uuid")
	@GeneratedValue(generator = "systemUUID")
	@Column(name = "staId")
	private String staId;
	private String staName;
	
	@JsonIgnore
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "orgId")
	private PlatOrg org;

	@ManyToMany(fetch=FetchType.LAZY,cascade={CascadeType.MERGE})
	@JoinTable(name = "t_sys_user_station", joinColumns = @JoinColumn(name = "staId"), inverseJoinColumns = @JoinColumn(name = "userId"))
	private Set<PlatUser> users = new HashSet<PlatUser>(0);

	public String getStaId() {
		return staId;
	}

	public void setStaId(String staId) {
		this.staId = staId;
	}

	public String getStaName() {
		return staName;
	}

	public void setStaName(String staName) {
		this.staName = staName;
	}

	public Set<PlatUser> getUsers() {
		return users;
	}

	public void setUsers(Set<PlatUser> users) {
		this.users = users;
	}

	public PlatOrg getOrg() {
		return org;
	}

	public void setOrg(PlatOrg org) {
		this.org = org;
	}

}
